import { Injectable } from '@angular/core';
import { environment } from 'src/environments/environment';
import { HttpClient, HttpParams } from '@angular/common/http';
@Injectable({
  providedIn: 'root'
})
export class WorkbenchService {
    Sale = '/Sale'
    Purchase = '/Supply'
   apiUrl= environment.apiUrl;
  constructor(private http: HttpClient) { }

  getAmountData() {
    return this.http.get(`${this.apiUrl}${this.Sale}/GetSaleAmountData`);
  }
  getToDoList() {
    return this.http.get(`${this.apiUrl}${this.Sale}/GetSaleToDoList`);
  }
  getStatistics() {
    const currentYear = new Date().getFullYear().toString();
    const params = new HttpParams().set('year', currentYear);
    return this.http.get(`${this.apiUrl}${this.Sale}/GetSaleStatisticsByYear`, { params });
  }
  // getIsFinished() {
  //   return this.http.get(`${this.apiUrl}${this.Sale}/IsFinished`);
  // }
  getMonthDelivery() {
    const currentYear = new Date().getFullYear().toString();
    const params = new HttpParams().set('year', currentYear);
    return this.http.get(`${this.apiUrl}${this.Sale}/GetSaleMonthDeliveryStatistics`, { params });
  }
  getRetutnCount() {
    const currentYear = new Date().getFullYear().toString();
    const params = new HttpParams().set('year', currentYear);
    return this.http.get(`${this.apiUrl}${this.Sale}/GetSaleReturnCountsByYear`, { params });
  }
  getPurchaseAmountData() {
    return this.http.get(`${this.apiUrl}${this.Purchase}/AmountData`);
  }
  getPurchaseToDoList() {
    return this.http.get(`${this.apiUrl}${this.Purchase}/ToDoList`);
  }
  getPurchaseStatistics() {
    return this.http.get(`${this.apiUrl}${this.Purchase}/Statistics`);
  }
  getPurchaseIsFinished() {
    return this.http.get(`${this.apiUrl}${this.Purchase}/IsFinished`);
  }
  getMonthArrival() {
    return this.http.get(`${this.apiUrl}${this.Purchase}/MonthArrival`);
  }
  IsReturned() {
    return this.http.get(`${this.apiUrl}${this.Purchase}/IsReturned`);
  }
  
}
